home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1999 April / Cd Pc Users extra 19 abril 1999.iso / Prog / Inst / Js02 / js02.exe / js / hideshow.js < prev    next >
Encoding:
Text File  |  1999-01-12  |  10.2 KB  |  227 lines

  1. function Hide_Show(signe_browser,NameId,LeftPos,TopPos,ValText){
  2.  
  3.     var meja=null;
  4.     var HideShow='';
  5.     var HideShow1='';
  6.     var HideShow2='';
  7.     var HideShow3='';
  8.     var HideShowNav1='';
  9.     var HideShowForm='';
  10.     var HideShowSelect1='';
  11.     var HideShowSelect2='';
  12.     var HideShowFormDiv='';
  13.     var LiveRef='<BASE HREF="http://www.buana.com/content/">  \n';
  14.     
  15.  
  16.     HideShow1  ='<HTML>   \n';
  17.     HideShow1 +='<TITLE>Hide Show Object: CROSS BROWSER DHTML/JAVASCRIPT: VERSION 1.00</TITLE>   \n';
  18.     HideShow1 +='<HEAD>   \n';
  19.     HideShow1 +='<STYLE TYPE="text/css">   \n';
  20.     HideShow1 +='A:link    {text-decoration:none; font:12pt modern; color:red; font-weight:bold}   \n';
  21.     HideShow1 +='A:visited    {text-decoration:none; font:12pt modern; color:red; font-weight:bold}   \n';
  22.     HideShow1 +='A:active    {text-decoration:none; font:12pt modern; color:red; font-weight:bold}   \n';
  23.     HideShow1 +='BODY {background: url(../image/snm_bgsawo.jpg); background-position: -120 0;}   \n';    
  24.     HideShow1 +='#ShowButton    {position:absolute; LEFT:100; TOP:30;}   \n';
  25.     HideShow1 +='#HideButton    {visibility:hidden; position:absolute; LEFT:100; TOP:30;}   \n';
  26.     HideShow1 +='#'+NameId+'     {visibility:hidden; position:absolute; font:30pt modern; color:red; font-weight:bold; LEFT:'+LeftPos+'; TOP:'+TopPos+';}   \n';
  27.     HideShow1 +='</STYLE>   \n';
  28.     HideShow1 +='<SCRIPT LANGUAGE="javascript" SRC="../jscripts/initv01.js"></SCRIPT>   \n';
  29.     HideShow1 +='<SCRIPT LANGUAGE="JavaScript" SRC="../jscripts/browser01.js"></SCRIPT>   \n'; 
  30.     HideShow1 +='<SCRIPT LANGUAGE="JavaScript" SRC="../jscripts/objvisv01.js"></SCRIPT>   \n';
  31.     HideShow1 +='<SCRIPT LANGUAGE="JavaScript">   \n';
  32.     HideShow1 +='    var nbrowser=-1;   \n';
  33.     HideShow1 +='function check_browser(){   \n';
  34.     HideShow1 +='    get_browser();   \n';
  35.     HideShow1 +='    if (browser.name ==  "Microsoft Internet Explorer")   nbrowser=1;   \n';
  36.     HideShow1 +='    if (browser.name ==  "Navigator Netscape") nbrowser=0;   \n';
  37.     HideShow1 +='}   \n';
  38.     HideShow1 +='var signe_show=0;   \n';
  39.     HideShow1 +='function ShowButton_over(){   \n';
  40.     HideShow1 +='    if (signe_show==0) Obj_Vis(nbrowser,1,"'+NameId+'","inherit");   \n';
  41.     HideShow1 +='    if (signe_show==3) signe_show=0;   \n';
  42.     HideShow1 +='    EndShowButton_over();   \n';
  43.     HideShow1 +='}   \n';
  44.     HideShow1 +='function ShowButton_out(){   \n';
  45.     HideShow1 +='    if (signe_show==0) Obj_Vis(nbrowser,1,"'+NameId+'","hidden");   \n';
  46.     HideShow1 +='    EndShowButton_out();   \n';
  47.     HideShow1 +='}  \n';
  48.     HideShow1 +='function ShowButton_click(){   \n';
  49.     HideShow1 +='    if (signe_show==1) {   \n';
  50.     HideShow1 +='        Obj_Vis(nbrowser,1,"'+NameId+'","hidden");   \n';
  51.     HideShow1 +='        signe_show=2;   \n';
  52.     HideShow1 +='    }   \n';
  53.     HideShow1 +='    if (signe_show==0) {   \n';
  54.     HideShow1 +='        Obj_Vis(nbrowser,1,"HideButton","inherit");   \n';
  55.     HideShow1 +='        Obj_Vis(nbrowser,1,"ShowButton","hidden");   \n';
  56.     HideShow1 +='        signe_show=1;   \n';
  57.     HideShow1 +='    }   \n';
  58.     HideShow1 +='    if (signe_show==2) {   \n';
  59.     HideShow1 +='        Obj_Vis(nbrowser,1,"HideButton","hidden");   \n';
  60.     HideShow1 +='        Obj_Vis(nbrowser,1,"ShowButton","inherit");   \n';
  61.     HideShow1 +='        signe_show=3;   \n';
  62.     HideShow1 +='    }   \n'; 
  63.     HideShow1 +='    EndShowButton_click();   \n';
  64.     HideShow1 +='}   \n';
  65.     HideShow1 +='function EndShowButton_over(){}   \n';
  66.     HideShow1 +='function EndShowButton_out(){}   \n';
  67.     HideShow1 +='function EndShowButton_click(){}   \n';
  68.     HideShow1 +='</SCRIPT>   \n';
  69.     HideShow2 +='</HEAD>   \n';
  70.     HideShow2 +='<BODY>   \n';
  71.     HideShow2 +='<DIV ID=ShowButton>   \n';
  72.     HideShow2 +='        <A HREF="javascript://" OnMouseOver="ShowButton_over()" OnMouseout="ShowButton_out()" OnClick="ShowButton_click(); return false;">   \n';
  73.     HideShow2 +='        Show</A>   \n';
  74.     HideShow2 +='</DIV>   \n';
  75.     HideShow2 +='<DIV ID=HideButton>   \n';
  76.     HideShow2 +='        <A HREF="javascript://" OnClick="ShowButton_click(); return false;">   \n';
  77.     HideShow2 +='        Hide</A>   \n';
  78.     HideShow2 +='</DIV>   \n';
  79.     HideShow2 +='<DIV ID='+NameId+'>   \n';
  80.     HideShow2 +='        '+ValText+'   \n';
  81.     HideShow2 +='</DIV>   \n';
  82.     HideShow3 +='</BODY>   \n';
  83.     HideShow3 +='</HTML>   \n';
  84.     HideShow3 +='<SCRIPT>var tc=check_browser();</SCRIPT>   \n';
  85.  
  86.  
  87.     HideShowSelect1  ='<SCRIPT LANGUAGE="JavaScript" SRC="../jscripts/objvisv01.js"></SCRIPT>  \n';
  88.     HideShowSelect1 +='<SCRIPT LANGUAGE="javascript" SRC="../jscripts/liveim2v01.js"></SCRIPT>  \n';
  89.     HideShowSelect1 +='<SCRIPT LANGUAGE="javascript">  \n';
  90.     HideShowSelect1 +='//  \n';
  91.     HideShowSelect1 +='// IMAGE SETUP FOR SELECTS BUTTON  \n';
  92.     HideShowSelect1 +='//  \n';
  93.     HideShowSelect1 +='SELECT1img1click = new Image();  \n';
  94.     HideShowSelect1 +='SELECT1img1click.src = "../image/snm_code_click.gif";  \n';
  95.     HideShowSelect1 +='SELECT1img1over = new Image();  \n';
  96.     HideShowSelect1 +='SELECT1img1over.src = "../image/snm_code_over.gif";  \n';
  97.     HideShowSelect1 +='SELECT1img1out = new Image();  \n';
  98.     HideShowSelect1 +='SELECT1img1out.src = "../image/snm_code.gif";  \n';
  99.     HideShowSelect1 +='//  \n';
  100.     HideShowSelect1 +='SELECT2img2click = new Image();  \n';
  101.     HideShowSelect1 +='SELECT2img2click.src = "../image/snm_preview_click.gif";  \n';
  102.     HideShowSelect1 +='SELECT2img2over = new Image();  \n';
  103.     HideShowSelect1 +='SELECT2img2over.src = "../image/snm_preview_over.gif";  \n';
  104.     HideShowSelect1 +='SELECT2img2out = new Image();  \n';
  105.     HideShowSelect1 +='SELECT2img2out.src = "../image/snm_preview.gif";  \n';
  106.     HideShowSelect1 +='//  \n';
  107.     HideShowSelect1 +='SELECT3img3click = new Image();  \n';
  108.     HideShowSelect1 +='SELECT3img3click.src = "../image/snm_back_click.gif";  \n';
  109.     HideShowSelect1 +='SELECT3img3over = new Image();  \n';
  110.     HideShowSelect1 +='SELECT3img3over.src = "../image/snm_back_over.gif";  \n';
  111.     HideShowSelect1 +='SELECT3img3out = new Image();  \n';
  112.     HideShowSelect1 +='SELECT3img3out.src = "../image/snm_back.gif";  \n';
  113.     HideShowSelect1 +='function select_over(k){  \n';
  114.     HideShowSelect1 +='    ly1="SELECT";  \n';
  115.     HideShowSelect1 +='    ly2="SELECT"+k;  \n';
  116.     HideShowSelect1 +='    Img=ly2+"img";  \n';
  117.     HideShowSelect1 +='    img_over2(nbrowser,ly1,ly2,Img,k);  \n';
  118.     HideShowSelect1 +='}  \n';
  119.     HideShowSelect1 +='function select_out(k){  \n';
  120.     HideShowSelect1 +='    ly1="SELECT";  \n';
  121.     HideShowSelect1 +='    ly2="SELECT"+k;  \n';
  122.     HideShowSelect1 +='    Img=ly2+"img";  \n';
  123.     HideShowSelect1 +='    img_out2(nbrowser,ly1,ly2,Img,k);  \n';
  124.     HideShowSelect1 +='}  \n';
  125.     HideShowSelect1 +='function select_click(k){  \n';
  126.     HideShowSelect1 +='    ly1="SELECT";  \n';
  127.     HideShowSelect1 +='    ly2="SELECT"+k;  \n';
  128.     HideShowSelect1 +='    Img=ly2+"img";  \n';
  129.     HideShowSelect1 +='    img_click2(nbrowser,ly1,ly2,Img,k);  \n';
  130.  
  131.     HideShowSelect1 +='    if (k==3) parent.frames[1].history.go(-1);  \n';
  132.     HideShowSelect1 +='    if (k==1) Obj_Vis(nbrowser,1,"'+NameId+'","hidden");  \n';
  133.     HideShowSelect1 +='    if (k==1) Obj_Vis(nbrowser,1,"SOURCE","inherit");  \n';
  134.  
  135.     HideShowSelect1 +='    if (k==2) Obj_Vis(nbrowser,1,"SOURCE","hidden");  \n';
  136.     HideShowSelect1 +='    if (k==2) Obj_Vis(nbrowser,1,"'+NameId+'","inherit");  \n';
  137.     HideShowSelect1 +='}  \n';
  138.     HideShowSelect1 +='</SCRIPT>  \n';
  139.     
  140.     HideShowSelect2  ='<DIV ID=SELECT STYLE="position:absolute; left:10; top:0;">  \n';
  141.     HideShowSelect2 +='    <DIV ID=SELECT1 STYLE="position:absolute; left:20; top:0;">  \n';
  142.     HideShowSelect2 +='        <A HREF="javascript://"  \n';
  143.     HideShowSelect2 +='        OnMouseOver="select_over(1)"  \n';
  144.     HideShowSelect2 +='        OnMouseOut="select_out(1)"  \n';
  145.     HideShowSelect2 +='        OnClick="select_click(1); return false;">  \n';
  146.     HideShowSelect2 +='        <IMG BORDER=0 NAME=SELECT1img SRC="../image/snm_code.gif"></A>  \n';
  147.     HideShowSelect2 +='    </DIV>  \n';
  148.     HideShowSelect2 +='    <DIV ID=SELECT2 STYLE="position:absolute; left:120; top:0;">  \n';
  149.     HideShowSelect2 +='        <A HREF="javascript://"  \n';
  150.     HideShowSelect2 +='        OnMouseOver="select_over(2)"  \n';
  151.     HideShowSelect2 +='        OnMouseOut="select_out(2)"  \n';
  152.     HideShowSelect2 +='        OnClick="select_click(2); return false;">  \n';
  153.     HideShowSelect2 +='        <IMG BORDER=0 NAME=SELECT2img SRC="../image/snm_preview.gif"></A>  \n';
  154.     HideShowSelect2 +='    </DIV>  \n';
  155.     HideShowSelect2 +='    <DIV ID=SELECT3 STYLE="position:absolute; left:220; top:0;">  \n';
  156.     HideShowSelect2 +='        <A HREF="javascript://"  \n';
  157.     HideShowSelect2 +='        OnMouseOver="select_over(3)"  \n';
  158.     HideShowSelect2 +='        OnMouseOut="select_out(3)"  \n';
  159.     HideShowSelect2 +='        OnClick="select_click(3); return false;">  \n';
  160.     HideShowSelect2 +='        <IMG BORDER=0 NAME=SELECT3img SRC="../image/snm_back.gif"></A>  \n';
  161.     HideShowSelect2 +='    </DIV>  \n';
  162.     HideShowSelect2 +='</DIV>  \n';
  163.  
  164.     screen_width();
  165.  
  166.     if (MyScreenWidth==800){
  167.         var MyRows=16;
  168.         var MyCols=50;
  169.     }else{
  170.         var MyRows=12;
  171.         var MyCols=38;
  172.     }
  173.     
  174.     HideShowForm  ='    <FORM NAME=test> \n';
  175.     HideShowForm +='        <TEXTAREA NAME=test2 name=output  ROWS='+MyRows+' COLS='+MyCols+'> \n';
  176.     HideShowForm +=LiveRef+HideShow1+HideShow2+HideShow3;
  177.     HideShowForm +='        </TEXTAREA> \n';
  178.     HideShowForm +='    </FORM > \n';
  179.  
  180.     HideShowFormDiv  ='<DIV ID=SOURCE STYLE="visibility:hidden; position:absolute; left:10; top:30;"> \n';
  181.     HideShowFormDiv +=HideShowForm;
  182.     HideShowFormDiv +='</DIV> \n';
  183.  
  184.  
  185.  
  186.     if (signe_browser==1){
  187.  
  188.         // meja=window.open("","online","width=580,height=380,LEFT=0,TOP=0,menubar=yes");
  189.         // meja.document.write(HideShow);
  190.         // meja.document.close();
  191.         // meja.focus();
  192.  
  193.         HideShow=HideShow1+HideShowSelect1+HideShow2+HideShowSelect2+HideShowFormDiv+HideShow3;
  194.  
  195.         parent.frames[1].document.write(HideShow);
  196.         parent.frames[1].document.close();
  197.  
  198.     }
  199.  
  200.     if (signe_browser==0){
  201.  
  202.  
  203.         Obj_Vis(nbrowser,1,'CONTENT','hidden');
  204.  
  205.         HideShowNav1  ='<DIV ID=MyFunction STYLE="visibility:hidden; position:absolute; font:30pt modern; color:red; font-weight:bold; LEFT:'+LeftPos+'; TOP:'+TopPos+';">   ';
  206.         HideShowNav1 +='        '+ValText+'   ';
  207.         HideShowNav1 +='</DIV>   ';
  208.  
  209.         document.SOURCE.document.open();
  210.         document.SOURCE.document.write(HideShowForm);
  211.         document.SOURCE.document.close();
  212.  
  213.         document.HIDEOBJ.document.open();
  214.         document.HIDEOBJ.document.write(HideShowNav1);
  215.         document.HIDEOBJ.document.close();
  216.  
  217.         Obj_Vis(nbrowser,1,'SELECT','inherit');
  218.         Obj_Vis(nbrowser,1,'PREVIEW','inherit');
  219.         Obj_Vis(nbrowser,1,'HIDEOBJ','inherit');
  220.  
  221.         Obj_Vis(nbrowser,2,"PREVIEW","HideButton","hidden");   
  222.         Obj_Vis(nbrowser,2,"PREVIEW","ShowButton","inherit");
  223.         window.scroll(0,0);
  224.     }
  225.  
  226. }
  227.